<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue测试.html</title>
    <!--导入js package-->
    <script type="text/javascript" src="../01-vue_js/vue.js"></script>
</head>
<body>
<div id="root">
    <h2>当前的n的值是{{n}}</h2>
    <button @click="add">点我+1</button>
</div>

<script type="text/javascript">
    // 关闭开发环境的警告提示
    Vue.config.productionTip = false
    // 创建vue的对象
    new Vue({
        el: '#root',
        data: {
            n: 1
        },
        methods: {
            add() {
                this.n += 1
            }
        },
        beforeCreate() {
            console.log("beforeCreate")
            console.log(this)
            // debugger;
        },
        created() {
            console.log("created")
            console.log(this)
            // debugger;
        },
        beforeMount() {
            console.log("beforeMount")
            console.log(this)
            // debugger;
        },
        mounted() {
            console.log("mounted")
            console.log(this)
            // debugger;
        },
        beforeUpdate(){
            console.log("beforeUpdate")
            console.log(this)
            // debugger;
        },
        updated(){
            console.log("updated")
            console.log(this)
            // debugger;
        },
        beforeDestroy(){
            console.log("beforeDestroy")
            console.log(this)
            // debugger;
        },
        destroyed(){
            console.log("destroyed")
            console.log(this)
            // debugger;
        }
    })
</script>
</body>
</html>